<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <title></title>
	<!-- 引入样式 -->
	<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/vant@1.6/lib/index.css">	
	<link rel="stylesheet" type="text/css" href="css/xq.css"/>
	<!-- 引入组件 -->
	<script src="js/vue.min.js"></script>
	<script src="js/vant.min.js"></script>
	<script src="html5plus://ready"></script>
</head>
<body>
	<div id="app">			
		<van-tabbar v-model="active" v-show="isShow" @change="tabChange">
		  <van-tabbar-item icon="shop-o">首页</van-tabbar-item>
		  <van-tabbar-item icon="apps-o">分类</van-tabbar-item>
		  <van-tabbar-item icon="cart-o">购物车</van-tabbar-item>
		  <van-tabbar-item icon="user-o">个人中心</van-tabbar-item>
		</van-tabbar>
	</div>
	<script type="text/javascript">
		var vm=new Vue({
			el:"#app",
			data:{
				views:[
					{name:"home",url:"views/home/home.html"},
					{name:"search",url:"views/classify/classify.html"},
					{name:"friends",url:"views/shopping/shopping.html"},
					{name:"abc",url:"views/setting/PersonalCenter.html"}
				],
				active:0,
				isShow:true
			},
			methods:{
				tabChange:function(){
					plus.webview.show(this.views[this.active].name);
					if(this.active==3){
						var newUser = localStorage.getItem("user");
						newUser = JSON.parse(newUser);
						if(newUser==null){
							var dl=confirm("你当前未登录，是否立即登录?");
							if(dl==true){
								plus.webview.open("views/setting/login.html", "login");
							}
						}
					}
				}
			},
			mounted:function(){
				_this=this;
				window.addEventListener("resize",function(){
					_this.isShow=!_this.isShow;
				})
				var rootWV=plus.webview.currentWebview();
				for(var i=0;i<this.views.length;i++){
					var tempWebView=plus.webview.create(this.views[i].url,this.views[i].name,{
						top:"0px",
						bottom:"50px",
						zindex:1,
						scrollIndicator:'none'
					})
					rootWV.append(tempWebView);
				}
				plus.webview.show(this.views[0].name);
			}
		})
	</script>
</body>
</html>